package com.uls.ldcm.service.impl;

import java.util.List;

import com.uls.common.utils.DateUtils;
import com.uls.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.uls.ldcm.mapper.PerformanceMapper;
import com.uls.ldcm.domain.Performance;
import com.uls.ldcm.service.IPerformanceService;

/**
 * 工作量考核Service业务层处理
 * 
 * @author gw
 * @date 2024-11-11
 */
@Service
public class PerformanceServiceImpl implements IPerformanceService 
{
    @Autowired
    private PerformanceMapper performanceMapper;

    /**
     * 查询工作量考核
     * 
     * @param performanceId 工作量考核主键
     * @return 工作量考核
     */
    @Override
    public Performance selectPerformanceByPerformanceId(Long performanceId)
    {
        return performanceMapper.selectPerformanceByPerformanceId(performanceId);
    }

    /**
     * 查询工作量考核列表
     * 
     * @param performance 工作量考核
     * @return 工作量考核
     */
    @Override
    public List<Performance> selectPerformanceList(Performance performance)
    {
        return performanceMapper.selectPerformanceList(performance);
    }

    /**
     * 新增工作量考核
     * 
     * @param performance 工作量考核
     * @return 结果
     */
    @Override
    public int insertPerformance(Performance performance)
    {
        performance.setCreatedAt(DateUtils.getNowDate());
        performance.setCreateBy(SecurityUtils.getLoginUser().getUser().getUserName());
        return performanceMapper.insertPerformance(performance);
    }

    /**
     * 修改工作量考核
     * 
     * @param performance 工作量考核
     * @return 结果
     */
    @Override
    public int updatePerformance(Performance performance)
    {
        performance.setUpdatedAt(DateUtils.getNowDate());
        performance.setUpdateBy(SecurityUtils.getLoginUser().getUser().getUserName());
        return performanceMapper.updatePerformance(performance);
    }

    /**
     * 批量删除工作量考核
     * 
     * @param performanceIds 需要删除的工作量考核主键
     * @return 结果
     */
    @Override
    public int deletePerformanceByPerformanceIds(Long[] performanceIds)
    {
        return performanceMapper.deletePerformanceByPerformanceIds(performanceIds);
    }

    /**
     * 删除工作量考核信息
     * 
     * @param performanceId 工作量考核主键
     * @return 结果
     */
    @Override
    public int deletePerformanceByPerformanceId(Long performanceId)
    {
        return performanceMapper.deletePerformanceByPerformanceId(performanceId);
    }
}
